﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SIPO.Library.DomainObject.Administration;
using SIPO.Library.DataAccess.Administration;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.DataAccess.Transaction;
using System.Configuration;
using SIPO.Library.DataAccess.Administration.Catalog;
using SIPO.Library.DomainObject.Administration.Catalog;
using System.Data;

namespace SIPO.Web.Reports.Transaction
{
    public partial class rptRecSanction : BasePage
    {
        protected override void OnLoad(EventArgs e)
        {
            //instansiasi object controller yang dibutuhkan recSanction
            recDebtorRepo recDebtorDal = new recDebtorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
            recTransactionTypeRepo recTransactionTypeDal = new recTransactionTypeRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);

            //instansiasi list object model
            List<recDebtor> debtors = recDebtorDal.GetList();
            List<recTransactionType> transTypes = recTransactionTypeDal.GetList();

            //mengisi dropdownlist recDebtor
            ddlDebitur.Items.Clear();
            if (debtors.Count > 0)
            {
                debtors.ForEach(delegate(recDebtor debtor)
                {
                    ddlDebitur.Items.Add(new ListItem(debtor.DebtorCode + " - " + debtor.DebtorName, debtor.DebtorID.ToString()));
                });
            }
            ddlDebitur.Items.Insert(0, new ListItem("-- Pilih Perusahaan --",string.Empty));

            //mengisi data dropdownlist recTransactionType
            ddlTipeSanksi.Items.Clear();
            if (transTypes.Count > 0)
            {
                transTypes.ForEach(delegate(recTransactionType transType)
                {
                    ddlTipeSanksi.Items.Add(new ListItem(transType.TransTypeCode + " - " + transType.TransTypeName, transType.TransTypeID.ToString()));
                });
            }
            ddlTipeSanksi.Items.Insert(0, new ListItem("-- pilih jenis sanksi --",string.Empty));
        }
    }
}